home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / fly8111-.000 / fly8111- / fly8 / ocrater.c < prev    next >
C/C++ Source or Header  |  1979-12-31  |  1KB  |  70 lines

  1. /* --------------------------------- ocrater.c ------------------------------ */
  2.  
  3. /* This is part of the flight simulator 'fly8'.
  4.  * Author: Eyal Lebedinsky (eyal@ise.canberra.edu.au).
  5. */
  6.  
  7. /* object: crater left by bomb.
  8. */
  9.  
  10. #include "fly.h"
  11.  
  12.  
  13. static SHAPE shape_crater = {
  14.     0,
  15.     0,
  16.     0,
  17.     1L, /* Now they know how many holes it takes to fill the Albert Hall */
  18.     0        /* drag */
  19. };
  20.  
  21. #define CLIFE    (5*60*TIMEPSEC)
  22. #define SLIFE    (1*60*TIMEPSEC)
  23. #define SRATE    4
  24.  
  25. LOCAL_FUNC int FAR
  26. create_crater (OBJECT *p)
  27. {
  28.     p->color = CC_RED;
  29.     p->time = CLIFE;
  30.     p->flags |= F_VISIBLE;
  31.     LVcopy (p->R, st.owner->R);
  32.     Mident (p->T);
  33.     return (0);
  34. }
  35.  
  36. LOCAL_FUNC void FAR
  37. dynamics_crater (OBJECT *p, int interval)
  38. {
  39.     int    n;
  40.  
  41.     if (st.flags1 & SF_SMOKE) {
  42.         n = CLIFE - p->time;
  43.         n = SLIFE - n;
  44.         if (n > 0) {
  45.             n = muldiv (n, SRATE, SLIFE);
  46.             n = TADJ (n);
  47.             while (n-- > 0)
  48.                 create_object (O_SMOKE, 1);
  49.         }
  50.     }
  51.     object_update (p, interval);
  52. }
  53.  
  54. #undef CLIFE
  55. #undef SLIFE
  56. #undef SRATE
  57.  
  58. BODY FAR BoCrater = {
  59.     0,
  60.     0,
  61.     "CRATER",
  62.     &shape_crater,
  63.     gen_read,
  64.     gen_term,
  65.     create_crater,
  66.     gen_delete,
  67.     dynamics_crater,
  68.     gen_hit
  69. };
  70.